﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Forraje.aspx.cs" Inherits="ForrajeriaFRONT.ABM.Forraje" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style2
        {
            width: 100%;
        }
        .style4
        {
            width: 77px;
        }
        .style7
        {
            width: 115px;
            height: 82px;
        }
        .style8
        {
            height: 82px;
            width: 174px;
        }
        .style14
        {
            width: 115px;
        }
        .style32
        {
        }
        .style35
        {
            width: 194px;
        }
        .style36
        {
            width: 147px;
        }
        .style37
        {
            width: 174px;
        }
        .style47
        {
            width: 20%;
        }
        .style48
        {
            width: 10px;
        }
        .style49
        {
            width: 13%;
        }
        .style51
        {
            width: 28%;
        }
        .style55
        {
            width: 16%;
        }
        .texto
        {}
        </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:Panel ID="panelInicio" runat="server">
    <table class="style2">
        <tr>
            <td>
                        <asp:Label ID="Label4" runat="server" Font-Bold="True" 
                    Text="Buscar Forraje"></asp:Label>
                    </td>
            <td>
                        <asp:Button ID="btnVolver1" runat="server" CausesValidation="false" 
                            onclick="btnVolver_Click" style="margin-left: 0px" Text="Buscar" />
                    </td>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td>
                        <asp:Label ID="Label3" runat="server" Font-Bold="True" 
                            Text="Generar Informe Forrajes"></asp:Label>
                    </td>
            <td>
                        <asp:Button ID="btnInforme" runat="server" onclick="btnInforme_Click" 
                            Text="Generar Informe" />
                    </td>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td>
                        <asp:Label ID="Label5" runat="server" Font-Bold="True" 
                            Text="Registrar un Nuevo Forraje"></asp:Label>
                    </td>
            <td>
                        <asp:Button ID="btnNuevo" runat="server" CausesValidation="false" 
                             style="margin-left: 0px" Text="Nuevo" onclick="btnNuevo_Click"  />
                    </td>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
    </table>
        </asp:Panel>
    
    <asp:Panel ID="panelCarga" runat="server" ForeColor="Black" 
        Visible="False">
    <asp:ValidationSummary ID="valSumary" runat="server" ForeColor="Red"  />
        <div>
      

        <table id="CargaDatos" runat="server" cellpadding="10" cellspacing="10" class="style2">
                
                <tr>
                    <td class="style49" colspan="4">
                        <asp:Label ID="lblNuevoForraje0" runat="server" Font-Bold="True" 
                            Text="Registrar Nuevo Forraje"></asp:Label>
                    </td>
                   
                </tr>
                <tr>
                    <td class="style49">
                        <asp:Label ID="lblNombre" runat="server" Text="Nombre" />
                    </td>
                    <td class="style55">
                        <asp:TextBox ID="txtNombre" runat="server" MaxLength="50" Width="108px" />
                    </td>
                    <td>
                        <asp:RequiredFieldValidator ID="reqNombre" runat="server" 
                            ControlToValidate="txtNombre" Display="None" 
                            ErrorMessage="Debe Ingresar Un Nombre" ForeColor="Red" Text="*" 
                            ValidationGroup="gGuardar"></asp:RequiredFieldValidator>
                    </td>
                    <td class="style51">
                        <asp:Label ID="lblStockActual" runat="server" Text="Stock Actual" />
                    </td>
                    <td class="style47">
                        <asp:TextBox ID="txtStockActual" runat="server" CssClass="texto" MaxLength="13" 
                            Width="70px" />
                    </td>
                    <td>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator3" Runat="server" 
                            ControlToValidate="txtStockActual" Display="Dynamic" EnableClientScript="False" 
                            ErrorMessage="Stock Solo se admite números forma nnnn,dd " ForeColor="Red" 
                            Text="*" ValidationExpression="\d*\,?\d*" ValidationGroup="gGuardar"></asp:RegularExpressionValidator>
                        <asp:RequiredFieldValidator ID="reqStockActual" runat="server" 
                            ControlToValidate="txtStockActual" Display="None" 
                            ErrorMessage="Debe Ingresar Stock" ForeColor="Red" Text="*" 
                            ValidationGroup="gGuardar"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td class="style49">
                        <asp:Label ID="lblEdad" runat="server" Text="Edad" />
                    </td>
                    <td class="style55">
                        <asp:DropDownList ID="ddlEdad" runat="server"  />
                    </td>
                    <td>
                        <asp:CustomValidator ID="custVal1" runat="server" 
                            ClientValidationFunction="ValidaDDL" ControlToValidate="ddlEdad" 
                            ErrorMessage="Seleccione Edad" ForeColor="Red" Text="*" 
                            ValidateEmptyText="True" ValidationGroup="gGuardar"></asp:CustomValidator>
                    </td>
                    <td class="style51">
                        <asp:Label ID="lblStockMaximo" runat="server" Text="Stock Maximo" />
                    </td>
                    <td class="style47">
                        <asp:TextBox ID="txtStockMaximo" runat="server" CssClass="texto" MaxLength="13" 
                            Width="100px" />
                    </td>
                    <td>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator1" Runat="server" 
                            ControlToValidate="txtStockMaximo" Display="Dynamic" EnableClientScript="False" 
                            ErrorMessage="Stock Solo se admite números forma nnnn,dd " ForeColor="Red" 
                            Text="*" ValidationExpression="\d*\,?\d*" ValidationGroup="gGuardar"></asp:RegularExpressionValidator>
                    </td>
                </tr>
                <tr>
                    <td class="style49">
                        <asp:Label ID="lblMarca" runat="server" Text="Marca" />
                    </td>
                    <td class="style55">
                        <asp:DropDownList ID="ddlMarca" runat="server" 
                             />
                    </td>
                    <td>
                        <asp:CustomValidator ID="custVal2" runat="server" 
                            ClientValidationFunction="ValidaDDL" ControlToValidate="ddlMarca" 
                            ErrorMessage="Seleccione Marca" ForeColor="Red" Text="*" 
                            ValidateEmptyText="True" ValidationGroup="gGuardar"></asp:CustomValidator>
                    </td>
                    <td class="style51">
                        <asp:Label ID="lblPeso" runat="server" Text="Peso" />
                    </td>
                    <td class="style47">
                        <asp:TextBox ID="txtPeso" runat="server" CssClass="texto" MaxLength="13" 
                            Width="100px" />
                    </td>
                    <td>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator4" Runat="server" 
                            ControlToValidate="txtPeso" Display="Dynamic" EnableClientScript="False" 
                            ErrorMessage="Peso Solo se admite números forma nnnn,dd " ForeColor="Red" 
                            Text="*" ValidationExpression="\d*\,?\d*" ValidationGroup="gGuardar"></asp:RegularExpressionValidator>
                    </td>
                </tr>
                <tr>
                    <td class="style49">
                        <asp:Label ID="lblPrecio" runat="server" CssClass="texto" Text="Precio/Kilo" />
                    </td>
                    <td class="style55">
                        <asp:TextBox ID="txtprecio" runat="server" MaxLength="10" Width="100px" />
                    </td>
                    <td>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                            ControlToValidate="txtprecio" Display="None" 
                            ErrorMessage="Debe Ingresar Precio" ForeColor="Red" Text="*" 
                            ValidationGroup="gGuardar"></asp:RequiredFieldValidator>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator5" Runat="server" 
                            ControlToValidate="txtprecio" Display="Dynamic" EnableClientScript="False" 
                            ErrorMessage="Precio Solo se admite números forma nnnn,dd " ForeColor="Red" 
                            Text="*" ValidationExpression="\d*\,?\d*" ValidationGroup="gGuardar"></asp:RegularExpressionValidator>
                    </td>
                    <td class="style51">
                        <asp:Label ID="lblStockMinimo" runat="server" Text="Stock Minimo" />
                    </td>
                    <td class="style47">
                        <asp:TextBox ID="txtStockMinimo" runat="server" CssClass="texto" MaxLength="13" 
                            Width="100px" />
                    </td>
                    <td>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator2" Runat="server" 
                            ControlToValidate="txtStockMinimo" Display="Dynamic" EnableClientScript="False" 
                            ErrorMessage="Stock Solo se admite números forma nnnn,dd " ForeColor="Red" 
                            Text="*" ValidationExpression="\d*\,?\d*" ValidationGroup="gGuardar"></asp:RegularExpressionValidator>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                            ControlToValidate="txtStockMinimo" Display="None" 
                            ErrorMessage="Debe Ingresar Stock Minimo" ForeColor="Red" Text="*" 
                            ValidationGroup="gGuardar"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td class="style49">
                        <asp:Label ID="lblAnimal" runat="server" Text="Animales:" />
                    </td>
                    <td class="style55">
                    <table border="1" style="width:100%;height:100%">
    <tbody>
    <tr>
    <td>
        <asp:CheckBoxList ID="chkAnimales" runat="server" 
                            >
                        </asp:CheckBoxList></td>
        </tr>
        </tbody>
        </table>
                        
                    </td>
                    <td>
                        &nbsp;</td>
                    <td class="style51">
                        &nbsp;</td>
                    <td class="style47">
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                </tr>
                <tr>
                    <td class="style49">
                        <asp:Label ID="lblDescripcion" runat="server" Text="Descripcion" 
                            Width="73px" />
                    </td>
                    <td class="style32" colspan="5">
                        <asp:TextBox ID="txtDescripcion" runat="server" Height="49px" MaxLength="250" 
                            TextMode="MultiLine" Width="99%" />
                    </td>
                </tr>
            </table>
&nbsp;</div>
        
        

   
     <div id="botones" class="botones">
     <table cellpadding="10" cellspacing="10">
     <tbody>
     <tr>
     
     
     
     <td class="style48">
     <asp:Button ID="btnLimpiar" Text="Limpiar" runat="server"
             CausesValidation="false" ToolTip="Limpia Formulario" 
             onclick="btnLimpiar_Click" />
     </td>
     <td>
     <asp:Button ID="btnGuardar" Text="Guardar" runat="server" Height="26px" 
             onclick="btnGuardar_Click" ValidationGroup="gGuardar" CausesValidation="true"
             />
     </td>
     <td class="style4">
         &nbsp;</td>
     <td>
     <asp:Label ID="mensaje" text="" runat="server" />
     </td>
     </tr>
     </tbody>
     </table>
 </div>
    </asp:Panel> 
    <!-- fin panel carga -->

    <asp:Panel ID="panelBusca" runat="server">
        <div>
            <table class="style2">
                <tr>
                    <td class="style35">
                        &nbsp;</td>
                    <td class="style36">
                        &nbsp;</td>
                </tr>
                <tr>
                    <td class="style35">
                        &nbsp;</td>
                        <td class="style36"></td>
                    <td>
                        <asp:Label ID="mensaje3" runat="server" text="" />
                    </td>
                </tr>
                <tr>
                    <td class="style35">
                        <asp:Label ID="lblBuscar" runat="server" Text="Buscar Forraje" Font-Bold="True"></asp:Label>
                    </td>
                    <td class="style36">
                        &nbsp;</td>
                </tr>
            </table>
        </div>
        <table class="style2" cellpadding="10" cellspacing="10">
            <tr>
                <td class="style14">
                    <asp:Label ID="lblNombre2" runat="server" Text="Nombre:" ></asp:Label>
                </td>
                <td class="style37">
                    <asp:TextBox ID="txtNombre2" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style14">
                    <asp:Label ID="lblMarca2" runat="server" Text="Marca:"></asp:Label>
                </td>
                <td class="style37">
                    <asp:DropDownList ID="ddlMarca2" runat="server">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="style14">
                    <asp:Label ID="lblEdad2" runat="server" Text="Edad"></asp:Label>
                </td>
                <td class="style37">
                    <asp:DropDownList ID="ddlEdad2" runat="server">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="style7">
                    <asp:Label ID="lblAnimal2" runat="server" Text="Animales"></asp:Label>
                </td>
                <td class="style8">
                    <asp:DropDownList ID="ddlAnimal" runat="server">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="style14">
                    &nbsp;</td>
                <td class="style37">
                    <asp:Button ID="btnBuscar2" runat="server" 
                         Text="Buscar" onclick="btnBuscar_Click"  />
                        
                    
                </td>
                <td><asp:Label ID="mensaje2" runat="server" /></td>
            </tr>
        </table>
        <div>
<asp:GridView ID="gridDatos" runat="server" CellPadding="4" ForeColor="#333333" 
                GridLines="None" AutoGenerateColumns="False" 
                EmptyDataText="No hay forrajes para mostrar" 
                DataKeyNames="codigoForraje,stock,descripcionForraje,stockMinimo,stockMaximo,codigoEdad,codigoMarca" 
                onselectedindexchanging="gridDatos_SelectedIndexChanging" 
                onrowdeleting="gridDatos_RowDeleting">
    <AlternatingRowStyle BackColor="White" />
    <Columns>
        <asp:BoundField DataField="nombre" HeaderText="Nombre" />
        <asp:BoundField DataField="marca" HeaderText="Marca" />
        <asp:BoundField DataField="edad" HeaderText="Edad" />
        <asp:BoundField DataField="animal" HeaderText="Animal" />
        <asp:BoundField DataField="peso" HeaderText="Peso" />
        <asp:BoundField DataField="precio" HeaderText="Precio Kilo" />
        <asp:CommandField ButtonType="Image" CancelText="" DeleteText="" 
            EditText="Editar" HeaderText="Editar" InsertText="" NewText="" 
            SelectImageUrl="~/images/modificarABM.jpg" SelectText="select" 
            ShowSelectButton="True" UpdateText="" />
        <asp:CommandField ButtonType="Image" CancelText="" 
            DeleteImageUrl="~/Images/borrarABM.jpg" DeleteText="" EditText="" 
            HeaderText="Quitar" InsertText="" NewText="" SelectText="" 
            ShowDeleteButton="True" ShowHeader="True" UpdateText="" />
    </Columns>
    <EditRowStyle BackColor="#7C6F57" />
    <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
    <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
    <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
    <RowStyle BackColor="#E3EAEB" />
    <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
    <SortedAscendingCellStyle BackColor="#F8FAFA" />
    <SortedAscendingHeaderStyle BackColor="#246B61" />
    <SortedDescendingCellStyle BackColor="#D4DFE1" />
    <SortedDescendingHeaderStyle BackColor="#15524A" />
</asp:GridView>

        </div>
    
    </asp:Panel>
    <!-- fin panel Busca -->
    <asp:Panel ID="panelInforme" runat="server">
        <table class="style2">
            <tr>
                <td style="text-align: right">
                    Animal</td>
                <td>
                    <asp:DropDownList ID="ddlAnimalInforme" runat="server">
                    </asp:DropDownList>
                </td>
                <td style="text-align: right">
                    Stock Actual Minimo</td>
                <td>
                    <asp:TextBox ID="txtStockActualInforme" runat="server"></asp:TextBox>
                    <asp:RangeValidator ID="RangeValidator1" runat="server" 
                        ControlToValidate="txtStockActualInforme" 
                        ErrorMessage="Debe Ingresar un Stock Valido" ForeColor="Red" 
                        ValidationGroup="gInforme" MaximumValue="1000000000" MinimumValue="0" 
                        Type="Double">*</asp:RangeValidator>
                </td>
            </tr>
            <tr>
                <td>
                    Estado</td>
                <td>
                    <asp:TextBox ID="txtEstadoInforme" runat="server"></asp:TextBox>
                </td>
                <td>
                    &nbsp;</td>
                <td>
                    <asp:Button ID="btnGenerarInforme" runat="server" onclick="Button1_Click" 
                        Text="Generar Informe" ValidationGroup="gInforme" />
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:Label ID="mensajeInforme" runat="server"></asp:Label>
                </td>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td colspan="4">
                    <asp:GridView ID="grdInformeForraje" runat="server" AutoGenerateColumns="False" 
                        CellPadding="4" ForeColor="#333333" GridLines="None">
                        <AlternatingRowStyle BackColor="White" />
                        <Columns>
                            <asp:BoundField DataField="CodigoForraje" HeaderText="CodigoForraje" 
                                Visible="False" />
                            <asp:BoundField DataField="NombreForraje" HeaderText="Nombre Forraje" />
                            <asp:BoundField DataField="StockActual" HeaderText="Stock Actual" />
                            <asp:BoundField DataField="StockMinimo" HeaderText="Stock Minimo" />
                            <asp:BoundField DataField="StockMaximo" HeaderText="Stock Maximo" />
                            <asp:BoundField DataField="Peso" HeaderText="Peso" />
                            <asp:BoundField DataField="Precio" HeaderText="Precio Por Kilo" />
                            <asp:BoundField DataField="Estado" HeaderText="Estado" />
                            <asp:BoundField DataField="NombreAnimal" HeaderText="Animal" />
                            <asp:BoundField DataField="NombreMarca" HeaderText="Marca" />
                        </Columns>
                        <EditRowStyle BackColor="#2461BF" />
                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                        <RowStyle BackColor="#EFF3FB" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <SortedAscendingCellStyle BackColor="#F5F7FB" />
                        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                        <SortedDescendingCellStyle BackColor="#E9EBEF" />
                        <SortedDescendingHeaderStyle BackColor="#4870BE" />
                    </asp:GridView>
                </td>
            </tr>
        </table>
        <asp:ValidationSummary ID="ValidationSummary1" runat="server" ForeColor="Red" 
            ValidationGroup="gInforme" />

    </asp:Panel>
</asp:Content>
